package com.cg.utils;

import com.cg.common.Constants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MQUtil {

    @Resource
    private RabbitTemplate rabbitTemplate;

    //发送消息
    public void sendMessage(String msg){
        //交换机名字
        //路由
        //令牌
        rabbitTemplate.convertAndSend(Constants.MQ.MAIL_EXCHANGE,Constants.MQ.MAIL_KEY,msg);
    }
}
